﻿using SourceStack.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SourceStack.Repositories
{
    public class SuggestRepository
    {
        private static IList<Suggest> suggests;
        static SuggestRepository()
        {
            suggests = new List<Suggest>
            {

                 new Suggest
                {
                Id=1,
                Title=@"关于学习编程转行程序员，收集同学们最关心的问题",
                Body=@"欢迎踊跃留言，比如：我大专学历，能不能学会编程？怎么才能学好编程？编程是不是吃青春饭的？……注意：不包括具体的技术问题，^_^ ……",
                Author=new User
                {
                    Id=23,
                    Name="xulijing "
                },
                PublishTime=new DateTime(2020,10,2,5,23,15)
                },
                  new Suggest
                {
                Id=2,
                Title=@" 操作不方便",
                Body=@"习惯了按返回键返回上一个界面，结果就退出了App ……",
                Author=new User
                {
                    Id=23,
                    Name="xulijing "
                },
                PublishTime=new DateTime(2020,10,2,5,23,15)
                },
                            new Suggest
                {
                Id=3,
                Title=@"关于学习编程转行程序员，收集同学们最关心的问题",
                Body=@"用于源栈教室墙壁，比如：今天学习不努力，明天努力找工作！键盘敲烂，月薪过万！ ……",
                Author=new User
                {
                    Id=23,
                    Name="xulijing "
                },
                PublishTime=new DateTime(2020,10,2,5,23,15)
                },
                  new Suggest
                {
                Id=4,
                Title=@" 【征集】计算机/编程发展史上著名图片/格言",
                Body=@"作为“源栈”墙壁装饰，比如：第一台计算机，图灵格言： ……",
                Author=new User
                {
                    Id=23,
                    Name="xulijing "
                },
                PublishTime=new DateTime(2020,10,2,5,23,15)
                }, new Suggest
                {
                Id=5,
                Title=@" 求助中的评论列表",
                Body=@"鼠标移动到评论中获得焦点的评论会变白其他的会变蓝页面首次加载时却都是白的个人认为应该是颜色写反了获得焦点应该是蓝色 没有焦点白色 ……",
                Author=new User
                {
                    Id=23,
                    Name="xulijing "
                },
                PublishTime=new DateTime(2020,10,2,5,23,15)
                },
                  new Suggest
                {
                Id=6,
                Title=@"激活email的邮件中的链接, 没有登录打开, 点击返回之前页面bug",
                Body=@" ……",
                Author=new User
                {
                    Id=23,
                    Name="xulijing "
                },
                PublishTime=new DateTime(2020,10,2,5,23,15)
                },
                            new Suggest
                {
                Id=7,
                Title=@" 将应答设为总结时报异常",
                Body=@"页面弹出了阻止提示的Modal：但后台仍然受到异常信息：System.Exception:用户（Id=3359）无权在该求助（Id=382）上发布总结，原因：求助既未撤销，也未酬谢 ……",
                Author=new User
                {
                    Id=23,
                    Name="xulijing "
                },
                PublishTime=new DateTime(2020,10,2,5,23,15)
                },
                  new Suggest
                {
                Id=8,
                Title=@" 用户排行榜定位错了",
                Body=@"我是coldcoder，但显示的却是： ……",
                Author=new User
                {
                    Id=23,
                    Name="xulijing "
                },
                PublishTime=new DateTime(2020,10,2,5,23,15)
                },
            };

        }
        internal IList<Suggest> Get(int pageIndex,  int pageSize)
        {
            return suggests
                .Skip((pageIndex - 1) * pageSize)
                .Take(pageSize).ToList();
        }
        internal int GetCount()
        {
            return suggests.Count();

        }
        public SuggestRepository()
        {

        }
        public Suggest Find(int id)
        {
            return suggests.Where(a => a.Id == id).SingleOrDefault();
        }
        void Delete()
        {

        }
    }
}
